package com.wtwd.campus.send;

import com.wtwd.campus.common.Constants;
import com.wtwd.campus.entity.Command;
import com.wtwd.campus.entity.MqGetLockDevice;
import com.wtwd.campus.entity.MqMessage;

/**
 * @author mjy
 * @date 2023/02/16
 * @description
 */
public class GetLockDeviceSender implements Sender {
    @Override
    public Command dealMessage(MqMessage mqMessage) {
        MqGetLockDevice mqGetLockDevice = (MqGetLockDevice) mqMessage.getObject();
        String imei = mqGetLockDevice.getImei();
        String cmd = mqMessage.getType();
        String commandNumber = mqGetLockDevice.getCommandNumber();
        String content="*".concat(Constants.MANUFACTURER_NAME).concat(",").concat(imei).concat(",").
                concat(cmd).concat(",").concat(commandNumber).concat("#");
        Command command = new Command();
        command.setImei(imei);
        command.setContent(content);
        command.setCmd(cmd);
        command.setStatus(Constants.COMMAND_NEED_SAVE);
        command.setCommandNumber(commandNumber);
        return command;
    }
}
